////////////////////////////////////////////////////////////////////////////////
//
//	This file is part of Woozox, see <http://code.google.com/p/woozox/>.
//
//	Copyright 2008-2009 Florian David
//
//	Woozoo is free software: you can redistribute it and/or modify
//	it under the terms of the GNU Lesser General Public License as 
//	published by the Free Software Foundation, either version 3 of 
//	the License, or (at your option) any later version.
//
//	Woozoo is distributed in the hope that it will be useful,
//	but WITHOUT ANY WARRANTY; without even the implied warranty of
//	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//	GNU General Public License for more details.
//
//	You should have received a copy of the GNU Lesser General Public 
//	License along with Woozoo. If not, see <http://www.gnu.org/licenses/>.
//
////////////////////////////////////////////////////////////////////////////////
package org.woozoo.xhtml.unittests.selectorsuite.selector
{
	import org.flexunit.asserts.assertTrue;
	import org.woozoo.xhtml.core.util.ElementArrayUtil;
	import org.woozoo.xhtml.unittests.selectorsuite.Case1;

	public class BracketCase extends Case1
	{
		[Test(order=1)]
		public function findElementWithDivId() : void {
			results = document.$$('div[id]');
			assertTrue(hasResultsAndLenEqual(1) && getFirstElement().id == "post-125C");
		}		
		[Test(order=2)]
		public function findElementWithDivIdEqualPost() : void {
			results = document.$$('div[id="post-125C"]');
			assertTrue(hasResultsAndLenEqual(1) && getFirstElement().id == "post-125C");
		}
		
		[Test(order=3)]
		public function findElementWithIdEqualPost() : void {
			results = document.$$('[id="post-125C"]');
			var results1 : Array = document.$$('*[id="post-125C"]');
			assertTrue(hasResultsAndLenEqual(1) && getFirstElement().id == "post-125C" && ElementArrayUtil.isEqual(results, results1));
		}		
			
		[Test(order=4)]
		public function findElementWithH3IdStartWithPost() : void {
			results = document.$$('div h3[id^="post"]');
			assertTrue(hasResultsAndLenEqual(4));
		}		
		
		[Test(order=5)]
		public function findElementWithStarIdStartWithPost() : void {
			results = document.$$('div *[id^="post"]');
			var result1 : Array = document.$$('div [id^="post"]');
			assertTrue(hasResultsAndLenEqual(4));
			assertTrue(ElementArrayUtil.isEqual(results, result1))
		}
				
		[Test(order=6)]
		public function findElementWithStarClassWithEntry() : void {
			results = document.$$('div[class~="hentry"]');
			assertTrue(hasResultsAndLenEqual(4));
		}		

		[Test(order=7)]
		public function findElementWithStarClassWithEntryHiphen() : void {
			results = document.$$('div[title|="tutu"]');
			assertTrue(hasResultsAndLenEqual(2));
		}	
		
		[Test(order=8)] 
		public function findElementWithDivId2() : void {
			results = document.$$('[id]');
			var results1 : Array = document.$$('*[id]');
			assertTrue(hasResultsAndLenEqual(5) && getFirstElement().id == "post-125C" && ElementArrayUtil.isEqual(results, results1));
		}	
		
		[Test(order=9)]
		public function findElementWithStarIdStartWithPostNoTag() : void {
			var results1 : Array = document.$$('div [id^="post"]');
			var results2 : Array = document.$$('div *[id^="post"]');
			assertTrue(ElementArrayUtil.isEqual(results1, results2));
		}	
		
		
	}
}